#ifndef SETTING_HPP_
#define SETTING_HPP_
#include <bb/system/CardDoneMessage.hpp>
#include <bb/system/InvokeManager>
#include <bb/system/InvokeRequest>
#include <bb/system/Clipboard>
#include <QtCore/QObject>
#include <QTextCodec>
#include <bb/device/DisplayInfo>
#include <QSettings>
#include <bb/cascades/ThemeSupport>
#include <bb/cascades/Application>
#include <QtNetwork/QNetworkAccessManager>

using namespace bb::system;

class Setting: public QObject
{
    Q_OBJECT

public:
    Setting(QObject *parent = 0);

    Q_INVOKABLE
    QString getValueFor(QString objectName, QString defaultValue);

    Q_INVOKABLE
    void saveValueFor(QString objectName, QString inputValue);

    Q_INVOKABLE
    void alert(QString info);

    Q_INVOKABLE
    QString getStyle(const QString &defaultStyle);

    Q_INVOKABLE
    void setStyle(const QString &inputStyle);

    Q_INVOKABLE
    QString getMode(const QString &defaultStyle);

    Q_INVOKABLE
    void setMode(const QString &inputStyle);

    Q_INVOKABLE
    QString getPushInfo(const QString &defaultStyle);

    Q_INVOKABLE
    void setPushInfo(const QString &inputStyle);

    Q_INVOKABLE
    QString getReg(const QString &defaultStyle);

    Q_INVOKABLE
    void setReg(const QString &inputStyle);

    Q_INVOKABLE
    QString getToken();

    Q_INVOKABLE
    QString getEncrypt(const QString &input);

    Q_INVOKABLE
    void setVisualStyle(QString style);

    Q_INVOKABLE
    QVariantMap getDisplay();

    Q_INVOKABLE
    void CopyToClipBoard(const QString &input);

    Q_INVOKABLE
    void SendEmail(const QString &email,const QString &title,const QString &body);

    Q_INVOKABLE
    void inVoke(QString target, QString action, QString mimetype, QString url, QString title);

    Q_INVOKABLE QString getCacheSize();
    Q_INVOKABLE void clearCache();
    quint64 dir_size(const QString & str);

    Q_INVOKABLE void RequestReg();
    Q_INVOKABLE void VerifyReg();

    Q_SIGNALS:
    void cacheSizeChanged(const QString &cacheSize);
    void requestRegChanged();
    void verifyRegChanged();

    private Q_SLOTS:
        void dataLoaded(const QVariant &data);


private:
    bb::system::InvokeManager *m_invokeManager;
    QString byteToQString(const QByteArray &byte);
    QByteArray qstringToByte(const QString &strInfo);

};
#endif
